// 验证模块
const Joi = require('joi');
// 房型模块
const {
    RoomType
} = require('../../../model/RoomType');

module.exports = async (req, res) => {
    const title = req.query.title;
    if (title) {
        // 查询房型信息
        const roomType = await RoomType.findOne({
            title
        });
        // 响应
        if (roomType) {
            return res.sendResult(roomType, 200, '获取房型信息成功');
        } else {
            return res.sendResult(null, 400, '房型不存在');
        }
    } else {
        return res.sendResult(null, 400, '参数不正确');
    }
};